package cn.silver.module.quartz.bean;

import cn.silver.framework.core.utils.DateUtils;
import cn.silver.framework.mybatis.bean.BaseBean;
import cn.silver.module.quartz.domain.SysJobLog;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author zhouxiaobo
 */
@Data
@NoArgsConstructor
@AutoMapper(target = SysJobLog.class)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "JobLogBean", title = "任务执行日志对象")
public class JobLogBean extends BaseBean implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(title = "任务名称")
    private String jobId;

    /**
     * 任务名称
     */
    @Schema(title = "任务名称")
    private String jobName;

    /**
     * 任务组名
     */
    @Schema(title = "任务组名")
    private String jobGroup;

    /**
     * 调用目标字符串
     */
    @Schema(title = "调用目标字符串")
    private String invoke;

    /**
     * 开始时间
     */
    @Schema(title = "开始时间")
    @JsonFormat(timezone = DateUtils.TIME_ZONE, pattern = DateUtils.YYYY_MM_DD_HH_MM_SS)
    private Date startTime;

    /**
     * 停止时间
     */
    @Schema(title = "停止时间")
    @JsonFormat(timezone = DateUtils.TIME_ZONE, pattern = DateUtils.YYYY_MM_DD_HH_MM_SS)
    private Date stopTime;

    @Schema(title = "执行耗时")
    private Long costTime;

    /**
     * 日志信息
     */
    @Schema(title = "日志信息")
    private String content;

    /**
     * 执行状态（0正常 1失败）
     */
    @Schema(title = "执行结果")
    private String result;

    /**
     * 异常信息
     */
    @Schema(title = "异常信息")
    private String message;

}
